home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Graphics / Sparkle2.1.5 folder / (Docs) / README 2nd < prev    next >
Encoding:
Text File  |  1994-09-04  |  44.3 KB  |  872 lines  |  [TEXT/ALFA]

  1. Sparkle: A new mac MPEG player.
  2. -------------------------------
  3. Documents for version 2.1.4
  4. This document looks best in 9 point monaco.
  5. On an MPW marks aware editor (like Alpha) this document has marks for 
  6. each section.
  7.  
  8. This document contains the following sections:
  9. INTRODUCTION
  10. LEGALITIES
  11. SAVING TO MPEG
  12. FAQs
  13. WHY DOESN'T SPARKLE DO....
  14. SMALL THINGS YOU MIGHT NOT HAVE NOTICED
  15. THE FUTURE
  16. HOW CAN YOU HELP IMPROVE SPARKLE?
  17.  
  18. ------------------------------------------------------------------------------
  19. INTRODUCTION
  20.  
  21. Hi there, friendly users. This is release 2.1.4 of my mac MPEG player.
  22. Version 1.0 of this code was based on the Berkeley MPEG unix code.
  23. (Anyone who wants to play with the Berkeley code can get it from 
  24. toe.cs.berkeley.edu in pub/multimedia/mpeg.) It was released as soon as 
  25. it was usable. This version no longer makes use of Berkeley code and uses 
  26. my own algorithms for greater speed, smaller memory footprint, and more 
  27. flexibility.
  28.  
  29. Version 2.0 of this code makes use of the Berkeley MPEG encoder, available 
  30. from the same place as above. Like version 1.0, this Berkeley code has not 
  31. been touched much except to make it Mac aware, object oriented, and thread 
  32. based. As a result, MPEG encoding is slow and a ridiculous memory hog 
  33. (what do you expect from UNIX coders---they seem to have no interest in 
  34. elegant design)? 
  35. As time permits I'll be going through that encoding code to make it faster 
  36. and use less memory.
  37.  
  38. Notice that there is a section of this document called FAQs.
  39. Please read it before sending me mail, thus avoiding wasting your time and 
  40. mine.
  41.  
  42. Please read all of this document before playing with the program. While 
  43. actually using the program is pretty simple, there are a few things you 
  44. should be aware of. Many of you may not care when I waffle on about 
  45. technical details. However I would ask all programmer readers (especially 
  46. people knowledgable about QuickTime, and especially Apple [and 
  47. ex-Apple :-( employees] to look at the tech sections and help me out with 
  48. comments and suggestions. Each time someone gives me a pointer on how to 
  49. do something it cuts a week or more off the release date of the next 
  50. version of Sparkle. 
  51.  
  52. Features:
  53. •    Standard mac interface with menus and windows.
  54. •    Uses the QuickTime movie controller to control the MPEG viewing.
  55. •    MultiFinder friendly, with good backgrounding behavior.
  56. •    Saves MPEGs to QuickTime movies.
  57. •    Can open multiple files at once.
  58. •   Can open QuickTime movies and sets of PICTs.
  59. •   Can encode MPEGs.
  60. •    Free.
  61.  
  62. To run it needs at least:
  63. •    System 7.
  64. •    QuickTime 1.6
  65. •    A 68020 or better.
  66. •    800K to play one 160x120 MPEG---to open more or large MPEGs increase the
  67.     partition. 
  68.     Encoding MPEGs requires much more memory---about a minimum of 1600K for a 
  69.     160x120 source. 
  70. •    The Thread Manager. Right now, the Thread Manager is an extension 
  71.     that you can get from any friend who knows a lot about macs, or from the 
  72.     apple ftp site. Ftp to ftp.apple.com and look in 
  73.     dts/mac/sys.soft/extensions for Thread_manager_201.hqx
  74.     I wish I could distribute it with Sparkle, but Apple's lawyers won't 
  75.     allow that. 
  76.     (Question for you as a user, does it make your Macintosh experience 
  77.     better or worse to find that a vital piece you need to run a program is 
  78.     not available with that program? Now try to explain that to Apple 
  79.     management, who sometime seem determined to make using a mac as difficult 
  80.     an experience as using a PC.)
  81.     The Thread Manager may be built into System 7.5 when that's released, at 
  82.     which point you won't need the extension.
  83.     
  84. This program works fine, with good handling of errors, on my Quadra 610, but 
  85. that's the only machine I have to test it. If you find a bug that is not 
  86. caused by the various things listed below, please mail me with as many 
  87. details as possible, both about your machine and about what the  program 
  88. was last doing before it died on you.
  89.  
  90. I don't think there's much to say on the use of this program---you pretty 
  91. much run it like any other mac program. There is a section in this 
  92. document on tips that may not be obvious. 
  93. When opening files, you can choose to show all files, or only files with a 
  94. .mpg suffix.
  95. If you choose the "show all files" option and open some random file, don't 
  96. be surprised when you are told that that is not a valid MPEG file.
  97. If you set the option to change file types, the file type of the MPEG file 
  98. you are changing will be changed to a Sparkle file, which will give it a 
  99. nice icon and allow you to open the file by double-clicking on it.
  100.  
  101. Underneath the movie controller for each window is a progress bar which 
  102. will update itself when slow things are happening. If you have a fast 
  103. machine (say a Quadra or Centris) this won't have to update itself much, 
  104. except if you open large (and not too common) MPEGs---say 320x240. If you 
  105. really want to see what the progress update looks like, try having lots of 
  106. MPEGs playing at once, then switch Sparkle into the background. 
  107. If you save an MPEG to QuickTime using Cinepak, your machine may appear to 
  108. freeze while each frame is being converted. I have installed code to 
  109. reduce the extent of the freeze, but basically this is a bug with 
  110. QuickTime---the system just grabs control and won't let go for about five 
  111. seconds. Maybe this'll be fixed in QuickTime 2.0 if we're lucky.
  112.  
  113. I have tested this program extensively under low-memory conditions when it 
  114. opens files and plays them.  It should never crash under those conditions.  
  115. In 600K you can easily open, play and save to QT a 120x160 I-frame MPEG.  In 
  116. 1500K you can open, play and save to QT a 320x240 IBP-frame MPEG.
  117.  
  118. Disk errors in various forms (bad sectors reading an MPEG file, no disk 
  119. space writing an QuickTime file, etc) will not crash, but the system will 
  120. put up an error alert and not handle the error very well (for example you 
  121. won't be given a chance to destroy old files to free up space on a disk). 
  122. Decent recovery from disk errors is on the list of things to do.
  123.  
  124. ------------------------------------------------------------------------------
  125. LEGALITIES
  126.  
  127. This program can be freely distributed.
  128. If you want to include it on a CD-ROM collection, please ask me first, 
  129. but I'll probably allow you.
  130. NOTE: Some authors will not allow their stuff to be distributed on CD-ROMs 
  131. for which people have to pay. I would ask these authors to consider things 
  132. more carefully. Many people (like myself) do not have very good ftp access 
  133. and a CD ROM of stuff is a godsend, even if we do have to pay a little for 
  134. it. Think about it.
  135.  
  136. If you feel a desperate need to thank me for this program, send me a 
  137. floppy of interesting MPEGs or QT movies you've picked up. 
  138. (Please don't e-mail me large files without warning.)
  139. My paper-mail address is 
  140.     Maynard Handley
  141.     ADI
  142.     284 Stuart Street
  143.     Dunedin
  144.     New Zealand
  145.  
  146. ------------------------------------------------------------------------------
  147. SAVING TO MPEG
  148.  
  149. The dialog box offering options when you save to MPEG is not that great 
  150. right now if you don't know what you're doing. I'm sorry---I'll fix it 
  151. when I have time, like everything else.
  152.  
  153. For a better explanation of how MPEG works, read the Technical Notes file 
  154. in this package, but here are rough details.
  155.  
  156. When encoding your MPEG you will need to decide what types of frames you 
  157. want to use. If you want your MPEG to be read widely, ie on PC systems, 
  158. you should consider using only I-frames. The most common MPEG decoder on 
  159. PCs is the Xing decoder which only understands the simple I-frame MPEG 
  160. format. If you want to get the best possible compression you should use 
  161. I, P and B frames, but then your MPEG will only be able to be read by 
  162. smarter decoders. A compromise is to use only I and P frames. This will 
  163. give you a lot of the compression benefit of I, P and B frames, but will 
  164. be faster to encode. 
  165.  
  166. If you don't want to know the details of these frames, choose a frame 
  167. pattern from the popup menu. 
  168. If you want to create your own frame pattern, here are some details:
  169. (If you don't want to create your own frame pattern, ignore these.)
  170. 1) The first frame in the MPEG will always be I. That implicit I frame is 
  171.     displayed in front of the frame pattern text you enter because it is 
  172.     always there and you don't need to put it in. That implicit I frame is 
  173.     only used for the first frame, after that your pattern is repeated as 
  174.     necessary. Thus if your pattern is BBPBBI, the encoder will encode frames 
  175.     using the sequence I BBPBBI BBPBBI BBPBBI ...
  176.     (For people who care about MPEG details, this is the playback order
  177.     of the frames. The actual order of the frames stored in the file 
  178.     will be be I PBBIBB PBBIBB PBBIBB.)
  179. 2) If you are using B frames, you have to start off with two referential 
  180.     frames, the initial I frame then either an I or a P frame.
  181. 3) The last few frames of the MPEG, if they would be B frames, will be 
  182.     converted to I-frames. (If this didn't occur, like in the original 
  183.     Berkeley encoder code before I munged it, you will lose those final 
  184.     frames.)
  185. 4) Don't create too long a pattern of Ps or Bs. You'll start to lose 
  186.     quality and random access into the movie will become more granular. The 
  187.     presets I've given should guide you as to sensible selections.
  188.  
  189. Once you have chosen a frame pattern, you'll need to select the amount of 
  190. compression you want to use. This is set by the I, P and B quantization 
  191. levels. The values the dialogs gives as defaults will usually make sense 
  192. but if you want to change them:
  193. 1) The values are restricted to the range 1 through 31 inclusive.
  194.     A quantization of 1 is the highest quality, a quantization of 31 is the 
  195.     lowest quality.
  196. 2) Normal quality is a quantization of about 8. Low quality is a 
  197.     quantization of about 16. High quality is about 6.
  198.  
  199. You can choose from various algorithms for generating P and B frames. I 
  200. haven't explored these in detail and they may change when I have time to 
  201. look at them. For now the important things to note are 
  202. 1) They all seem to generate about the same quality, and about the same 
  203.     file size.
  204. 2) They are ordered in the menus by speed, with the fastest ones first.
  205. 3) The B-frame exhaustive search will take approx forever to do anything. 
  206.     Try it once to see what I mean, but don't expect to use it for anything 
  207.     useful.
  208. As I explore these more and start diddling the code, I'll provide more 
  209. explanation.
  210.  
  211. If you save to MPEG, because of the non-causal algorithms used by MPEG 
  212. compression, frames are not compressed in the order they are displayed. 
  213. This means that if you are using B-frames and stop the compression before 
  214. it reaches the end of the source movie, the encoder may have queued up 
  215. some frames it needs to compress to make the MPEG file consistent. 
  216. If this is the case, Sparkle will have to encode those queued frame before 
  217. it stops the compression, so it won't stop immediately. 
  218. The message window will tell you how many frames have been queued so you can see 
  219. how things are going. If you have the speech manager installed, Sparkle 
  220. will also tell you how many frames are left, which you may find more 
  221. convenient.
  222.  
  223. You can set the frame rate from a popup menu. When the dialog box opens, 
  224. the frame rate of the MPEG or QT movie you are converting has its frame 
  225. rate read in and used to set the initial frame rate. So usually you won't 
  226. want to change the frame rate. Note that there are a limited set of frame 
  227. rates because MPEG only supports a very few frame rates. So the best one 
  228. possible is chosen.
  229. Note also that frames are laid down with that frame rate which may cause 
  230. the movie to speed up or slow down. No frame interpolation is done to 
  231. ensure that perception remains correct across frame rate variation. 
  232. This'll be changed at some point, but is not a high priority compared to 
  233. sound.
  234.  
  235. When an MPEG is encoded the frame currently being encoded may be compared 
  236. to the original version of a previous frame, or to what you get when you
  237. decompress the MPEG compressed version of the earlier frame. The latter 
  238. alternative is called ``Decoding Reference Frames''. If you use this 
  239. latter alternative the compression takes a little longer but results in 
  240. files a few percent smaller and slightly better quality. I'd recommend 
  241. you leave this option selected.
  242.  
  243. An MPEG can be encoded using using what are called half-pixels which means 
  244. that some pixels in a P- or B-frame are specified as an average of pixels 
  245. around them.  If you use half-pixels the MPEG created will be a few percent 
  246. smaller than if you don't use half-pixels and the quality will appear 
  247. better IF you play the MPEG on an MPEG player that handles half-pixels.  
  248. However if you use an MPEG player that does not understand half-pixels the 
  249. result may look pretty shabby in places where there is a lot of action.  
  250. Also, using half-pixels makes encoding slower and increases the amount of 
  251. memory used by almost two-thirds. For these reasons I'd recommend not 
  252. selecting this option.
  253.  
  254.  
  255. Earlier versions of Sparkle required massive amounts of memory to encode 
  256. MPEGs. This has been improved substantially in 2.1.4. There is still room 
  257. for improvement but that will have to come later
  258.  
  259. At present MPEG encoding requires a huge amount of memory. As I find time 
  260. I'll reduce this substantially. At present, the following will give you 
  261. an idea of how much memory you need to encode an MPEG.
  262. Let the width of the MPEG file you wish to encode be w (say 160) and the 
  263. height be h (say 120).
  264. Then for an MPEG comprised of only I-frames you will need 4.5*w*h bytes of 
  265. RAM for encoding 
  266. (with the example numbers given this is 4.5*120*160 = 4.5*20K = 90K).
  267. For an MPEG comprised of P-frames you will need 15*w*h bytes of RAM and
  268. for an MPEG comprised of I-, P- and B-frames you will need 22.5*w*h bytes 
  269. of RAM. 
  270. There may be a few odd bits and pieces added to this, maybe another 5% or 
  271. so, but this should give you order or magnitude.
  272. In addition to this RAM for the encoding you will need the RAM used by 
  273. the Sparkle application (around 400 K) and the RAM used by the QuickTime 
  274. movie or whatever your source is which is probably a few hundred K. You 
  275. can probably take these base requirements together as about one MB or so.
  276.  
  277. If you don't use half pixels the numbers are reduced.
  278.  
  279. Scale factors
  280.                         Without half-pixels        With half-pixels
  281.             I           IP          IPB            IP            IPB
  282. w*h*       4.5          9          13.5         15          22.5
  283.  
  284.  
  285. So for some standard sizes:
  286.                         With half-pixels        Without half-pixels
  287.             I           IP          IPB            IP            IPB
  288. 160x120     90K        180K        270K        300K        450K
  289. 320x240    360K        720        1.08M        1.2M        1.8M
  290. 640x480   1.44M       2.88M       4.32M        4.8M        7.2M
  291.  
  292.  
  293. ------------------------------------------------------------------------------
  294. MENU OPTIONS
  295.  
  296. Here are various points related to the menu options:
  297.  
  298. • File| Save As: 
  299.     This allows you to start saving a movie or pseduo-movie 
  300.     (made from a set of PICTs) as an MPEG or QuickTime file. Once you start 
  301.     the save it continues in the background. This menu item changes to 
  302.     File| Stop Saving which will stop the saving at once. 
  303.     You may want to pause the saving but not stop it, for example so that 
  304.     you can play another movie at top speed. To pause, simply click anywhere 
  305.     in the movie controller or type any key.
  306.     When the saving is busy working away the movie controller play button 
  307.     shows a pause symbol, because if you click there it will pause the saving.
  308.     When the saving is paused, the movie controller play button shows a play 
  309.     symbol because if you click the saving will resume.
  310. • Image|Grow or Shrink
  311.     The scaling of the window at any time is given in the title bar. 
  312.     When the title starts with *1, the movie is its natural size. 
  313.     With *2 the movie has been doubled in size. 
  314.     With /2 the movie has been halved in size.
  315.     For now if you expand or shrink movies beyond their natural size 
  316.     playback will be much slower and quality may not be as good. I'll be 
  317.     adding code to fix this soonish.
  318.     
  319. • Image| Hide All
  320.     You can hide or show all the decorations below the movie windows. The 
  321.     easiest way to do this is with the tab, shift-tab and control-tab keys, 
  322.     or with command-H. You may want to do this because the decorations 
  323.     irritate you or because hiding the decorations makes playback speed a 
  324.     few percent faster.
  325.  
  326. • Playback| Play All Frames: 
  327.     If this is set, every frame of the movie will be played. The movie will 
  328.     try to play in real time, but may be slower than real time if necessary. 
  329.     It will never be faster than real time. 
  330.     With quicktime movies sound is disabled when this option is on.
  331.     When this option is off, the movie will play back in real time which may 
  332.     mean skipping some frames. For MPEGs, how well this works depends on how 
  333.     fast your mac is. (Also read the section on play rate below.)
  334.     
  335. • Playback| Play at Double Speed:
  336.     These options set the  movie to play twice as fast, at the normal rate, 
  337.     or twice as slowly. Note that if Play All Frames is active, playing the 
  338.     movie at double speed may be no faster than playing it at normal speed 
  339.     because both ways the calculation of each frame is overloading the mac.
  340.     Some MPEGs look jerky and too fast when played at their normal speed and 
  341.     with Play All Frames switched off. This is because the MPEGs have been 
  342.     encoded at too high a frame rate. For example the original movie may 
  343.     been sampled at 12 frames per second but it's encoded as an MPEG of 24 
  344.     (or 23.976) frames per second. This happens because the lowest possible 
  345.     frame rate with MPEG is 23.976 fps. So if this happens, you may want to 
  346.     set the MPEG to play at half speed. 
  347.     You can also control the speed at which movies play by command-clicking 
  348.     in the steppers of the movie controller.
  349.  
  350. • Edit| Preferences| Faster Mode: 
  351.     If you set this option, whenever Sparkle is busy, either playing movies 
  352.     or encoding movies, it will not yield time to background applications. 
  353.     This makes playback a little faster and smoother. 
  354.     However if you have an application doing something in the background,
  355.     for example a modem download or a background compile, you might want to 
  356.     deselect this option.
  357.     By my testing, when Faster mode is on Sparkle uses up about 90% of the 
  358.     CPU. When faster mode is off Sparkle uses up about 70% of the CPU.
  359.     (When Sparkle is in Faster mode it still has to use the EventAvail() trap 
  360.     every so often to see if the user has issued a command, moved the window, 
  361.     grown it or whatever. It's these calls to EventAvail() which can yield the 
  362.     CPU to other processes that suck up the 10% of the CPU not used by 
  363.     Sparkle in Faster mode. Anyone know how to perform the equivalent of 
  364.     EventAvail() without allowing the Process Manager to yield?)
  365.  
  366. ------------------------------------------------------------------------------
  367. MPEG PLAYBACK PREFERENCES
  368.  
  369. The MPEG Playback Preferences dialog (use command-R or look under the 
  370. Preferences menu under the Edit menu) allows you to set general playback 
  371. preferences. Most of these are concerned with how you wish to balance 
  372. playback speed against playback quality. Note that whatever settings you 
  373. choose for playback, when you save an MPEG file to another format all 
  374. settings are switched to the highest quality while the save is in 
  375. progress, so you don't need to worry about losing quality that way.
  376.  
  377. • Clip YCrCb:
  378.     What this refers to is an intermediate stage in the MPEG decoding. The 
  379.     values for Y, Cr and Cb should be between 0 and 255 but some MPEGs are 
  380.     encoded so that some Y or Cr or Cb values are calculated to be below 0
  381.     or above 255. If you don't select this option, Sparkle doesn't check the 
  382.     Y Cr Cb values and clip them if they are out of bounds. This makes 
  383.     playback about 10% faster, but may (if the values are out of bounds) 
  384.     lead to dots of incorrect color or black dots in areas of white or 
  385.     suchlike.
  386.  
  387. The other quality options are used depending on the screen depth of the 
  388. screen on which the MPEG is playing. So if your MPEG is on a 16-bit 
  389. screen, the 16-bit color options are used.
  390. • Use 4x4 IDCT:
  391.     One time-consuming part of MPEG decoding is the IDCT which is somewhat 
  392.     like a Fourier transform. This should be performed using a matrix of 8x8 
  393.     coefficients. If you select this option only a 4x4 subset of that matrix 
  394.     will be used. This makes the calculation a lot faster, but the cost is 
  395.     some blurriness to the image which is usually acceptable.
  396. •Use half-pixels:
  397.     Half-pixels are a scheme whereby certain pixels in the image are 
  398.     represented in the MPEG file as an average of nearby pixels. Calculating 
  399.     these averages takes time but improves quality. I'd recommend not 
  400.     bothering with half-pixels on an 8-bit color screen because the dithering 
  401.     hides the fine detail they reveal. For other screen depths you decide.
  402.     Some MPEGs will not be affected by this setting, because they were coded 
  403.     not to use half-pixels.
  404.  
  405. • 24-bit screens display options:
  406.     The high quality setting corresponds to clipping RGB while the faster 
  407.     setting does not clip RGB.
  408.     This is the same sort of issue as the Clip YCrCb note above, only 
  409.     occurring at a later stage in processing. Some MPEGs look fine with 
  410.     neither form of clipping, some only need one or the other, and some need 
  411.     both. (This option is not an issue for 8 and 16 bit screens because they 
  412.     use a different way of calculating RGB for their display---not as high 
  413.     quality as the 24-bit method, but good enough for the given screen 
  414.     depth.)
  415. • 8-bit color screens display options:
  416.     You have a choice of three dither options on an 8-bit screen. 
  417.     * Fast dithering uses an algorithm I invented. It is phenomenally fast, 
  418.     but not the greatest quality. It looks especially bad for things that 
  419.     need very sharp edges, like text. (It also uses 128K of storage to do its 
  420.     thing, so if you're low on space you may want a different option.
  421.     When this option is activated for the first time --- for example when 
  422.     you switch to 8-bit colors screen depth from some other depth, or when 
  423.     you first open an MPEG under 8-bit screen depth --- these 128K of tables 
  424.     have to be calculated which takes about 1.5 sec on my Quadra 610. 
  425.     In a future version of the code I'll implement ideas I have for removing 
  426.     this delay.)
  427.     * Use 16-bit pixmap calculates everything using a temporary 16bit pixmap 
  428.     which is then dithered on the screen using QuickDraw. It's a compromise---
  429.     the quality is better than fast dithering and it uses less memory than 
  430.     the 24-bit scheme.
  431.     * Use 24-bit pixmap works like 16-bit pixmaps, but all calculations are 
  432.     performed on a 24-bit pixmap (using RGB clipping). 
  433.     This gives the best results, but is slower than the 16-bit pixmap case and 
  434.     uses more memory.
  435.     * I hope to improve the quality of the fast dithering algorithm in the 
  436.     near future. 
  437.     * Also at some point I'll add code to allow you to set an optimal palette
  438.     when playing on 8-bit color screens. At present I simply use whatever 
  439.     palette the screen is using, usually the system palette.
  440. • 16-bit screen display options:
  441.     You have three options. 
  442.     * The fast option uses a lookup table directly on the MPEG YCrCb data to 
  443.     get RGB values. This is faster but gives lower quality.
  444.     * The 16bit high-quality option calculates the RGB values properly (with 
  445.     greater precision than using a lookup table). It gives better quality 
  446.     but is slower. (At present I haven't yet written the code for this 
  447.     option so it is disabled.)
  448.     * The 24bit pixmap option calculates results using a 24-bit pixmap (and 
  449.     RGB clipping), then dithers the result to the 16bit screen. It gives the 
  450.     best quality but is slowest.
  451.  
  452. • For 8-bit grey screens:
  453.     Two points to note. 
  454.     * Is your graphics card set to grey mode? If you have a grey screen but in the 
  455.     monitors control panel you have set your graphics card to color, Sparkle 
  456.     will think it's on an 8-bit color screen. This will give you slower 
  457.     playback and lower-quality results.
  458.     * For the fastest possible playback, I assume that the screen palette is 
  459.     set to the system palette. On an 8-bit grey screen there is never any 
  460.     reason to change this. Nonetheless, some applications feel they simply 
  461.     have to perform this pointless exercise whose only effect is to reduce 
  462.     the quality of what's displayed by other applications. (Would you be at 
  463.     all surprised to learn that Word, one of the masterpieces from those 
  464.     geniuses at Redmond, is such an application? I though not.) 
  465.     What this means is that if you are running Word (or another of these 
  466.     ill-behaved applications) in the background, Sparkle will playback MPEG 
  467.     files somewhat slower than it should.
  468.  
  469. In summary: 
  470. The fastest playback possible is on a 8-bit grey screen, followed by 
  471.   8-bit color, then 16-bit color, then 24-bit color. 
  472. For fastest playback, deselect the ClipYCrCb option, 
  473.   select the Use 4x4 IDCT option, 
  474.   deselect the Use Half-Pixels option
  475.   for 8-bit screens use fast dithering 
  476.   for 16bit screens use 16bit fast
  477.   for 24bit screens use 24bit fast
  478.   use command-H to hide all the decorations below the video window.
  479. For highest quality playback, use the deepest screen-depth you can,
  480.   select ClipYCrCb 
  481.   deselect the Use 4x4IDCT option,
  482.   select the Use Half-Pixels option
  483.   select the 24-bit pixmap option
  484.  
  485. Decoding MPEGs requires lots of computation, but can be made faster by 
  486. sacrificing some quality. I've tried to allow you to make your own choice 
  487. about which you prefer. But remember I can't work miracles. For example I 
  488. can't magically give you an 8-bit color dither algorithm that gives the 
  489. same quality as the QuickDraw but runs at the speed of my fast dithering. 
  490. I'll try to improve the quality of the high-speed options in future, but 
  491. I can't promise anything.
  492.  
  493. The one other item in this dialog box is the 
  494. "Prefer 8-bit color to 8 bit-grey" checkbox. This is only relevant to 
  495. people who have more than one screen, at least one of which is grey and 
  496. at least one of which is color. 
  497. When Sparkle opens a file it orders all the screns available by screen 
  498. depth and tries to open a window on the deepest depth screen. But if you 
  499. have one screen set to 8-bit grey and the other set to 8-bit color it 
  500. can't know which you'd prefer, hence this setting. You may prefer the 
  501. color screen because any color is better than none, or the grey screen 
  502. because it gives faster playback and no fuzziness from dithering.
  503. (After ordering the screens by depth, Sparkle notes where other movie 
  504. windows have been placed and tries to place the new window so it doesn't 
  505. overlap any of the old windows. Also, if the window opened is large than 
  506. any screen, it will be opened at half size or whatever so it does fit on 
  507. the screen. I hope you like this algorithm. It works better than what 
  508. every other program I've seen uses. If you have comments about it, please 
  509. mail me.)
  510.  
  511. ------------------------------------------------------------------------------
  512. PICT FILES AND PSEUDO-MOVIES
  513.  
  514. Sparkle can open a set of PICT files to convert them to an MPEG or QT 
  515. movie. This may be useful if you have enough program, like a graphing 
  516. program, that creates a set of PICTs, or if you have a set of medical 
  517. scans or such. 
  518.  
  519. The only picture format Sparkle understands is PICT, the Mac standard 
  520. picture format. I do not plan to change this because there are lots of 
  521. programs out there, many of them free and many of them capable of running 
  522. in batch, that will convert whatever format you have to PICT.
  523.  
  524. Once you have your pictures in PICT format, they need to be in the same 
  525. folder and given the same name so that Sparkle can link them together.  For 
  526. example, if these pictures represent x-rays of your head, call them 
  527. myHead.1, myHead.2, etc.  They must be named name.# where name is common to 
  528. all files and # is a number.  The numbers don't have to start at zero or 
  529. one, and don't have to be contiguous.  However they must all be positive 
  530. integers.
  531.  
  532. From the open files dialog open one of your PICTs---whichever one you get 
  533. to first, it doesn't have to be the lowest numbered one. Sparkle will 
  534. scan the folder for other PICT files with that name and a number added, 
  535. order the files it finds, and display them all in a movie window. 
  536. You can now treat this pseudo-movie like any other movie. You can grow or 
  537. shrink the window, step forwards or backwards, etc. You can play the 
  538. movie if you like, but for these PICT pseudo-movies I set the framerate 
  539. to only one frame per second. Decoding a PICT can be fairly slow---it 
  540. involves disk access and lots of memory---so don't expect this to work 
  541. wonderfully. You can now save the pseudo-movie as an MPEG or QT movie 
  542. just as you would normally.
  543.  
  544. The PICTs may be different sizes, but the window opened will be the size of 
  545. the PICT you select in the open file dialog box. The other PICTs will be 
  546. scaled to fit this size window and may not look too good. I wouldn't 
  547. recommend using a set of PICTs that aren't all the same size.
  548.  
  549. Note that for now I don't do anything special when I draw the pictures. 
  550. In particular this means on screens that aren't 24-bit or 16-bit I don't 
  551. dither the picture. This will be fixed fairly soon. For now everything 
  552. all works and it doesn't affect the quality of movies you create.
  553. I'll also be adding code to save MPEGs or QuickTime movies as a set of 
  554. PICTs fairly soon.
  555.  
  556. ------------------------------------------------------------------------------
  557.  
  558. QUICKEYS AND BATCH CONVERSION
  559.  
  560. I won't have AppleScriptability in place for a few months, but I have 
  561. been asked by some users for a rudimentary support for batch conversions. 
  562. Specifically people wanted a way for Sparkle to indicate that it was done 
  563. encoding a given file.
  564.  
  565. I have provided such a capability for QuicKeys users in a very crude 
  566. fashion. When Sparkle has finished converting a file to a different 
  567. format it will toggle the cursor from the standard arrow cursor to a 
  568. thick cross for one second. 
  569. Note which cross this is: It is not a thin one pixel wide cross, neither is
  570. it a spreadSheet like cross with arms a few pixels wide. This cross has 
  571. arms that are two pixels wide.
  572.  
  573. To use this capability in QuicKeys, you want to put in your sequence a 
  574. Wait..  command. Make the Wait command a WaitForCursor variant, and set 
  575. the options to wait until the cursor becomes ``Other...''. In the 
  576. ``Other'' dialog box choose the appropriate cursor---in my version of 
  577. QuicKeys it's the fourth cursor along. UnSet the Test for Mask box and 
  578. set the Test for Cursor box.
  579.  
  580. I would recommend that you structure your sequence like this:
  581.     Wait ...      ---Wait for the cursor
  582.     Pause...    ---Pause for a second
  583.     Pause...    ---Pause for five seconds or so
  584.     Do your thing.
  585.  
  586. The first pause in the above is to wait until Sparkle finishes its one 
  587. second flash of this cross cursor. The second is to wait for general disk 
  588. activity and such to finish. At that point you can then go on to whatever 
  589. the rest of your sequence does, like maybe close Sparkle then open it 
  590. again with a new file. 
  591.  
  592. ------------------------------------------------------------------------------
  593.  
  594. FAQs (Frequently asked questions).
  595.  
  596. • I try to play MPEGs but my Mac starts speaking numbers or asks me over and 
  597. over to select a voice.
  598.     You have the Speech Manager installed on your Mac including a little 
  599.     extension called ``Speech Media Handler''. Speech Media Handler speaks
  600.     the text of movies that include a text track, and Sparkle plays MPEGs 
  601.     by creating a dummy text track as part of the process of faking QuickTime 
  602.     into accepting MPEGs. I'd recommend ditching Speech Media Handler. I've 
  603.     never seen a place where it is useful and right now it's kinda a cute toy 
  604.     idea that escaped from Apple. Maybe in a few months they'll give it a 
  605.     programmer interface and make it more useful.
  606.     
  607. • I've downloaded (or uploaded) an MPEG using Mosaic/WWW and when I try to 
  608. play it Sparkle says it's not an MPEG file. But if I ftp the file with 
  609. Fetch or suchlike it works fine. What's happening?
  610.     Be very careful when transferring files over the Internet with MacBinary.
  611.     Fetch and many such programs automatically strip MacBinary from files,
  612.     but Mosaic does not appear to (maybe this will be fixed soon). So 
  613.     if an MPEG is stored at a Mosaic site using MacBinary, all Mosaic users
  614.     trying to download it will have problems.
  615.  
  616. • Why when I try to step back one frame do I sometimes step back 5 or six 
  617. frames?
  618.     You are viewing an MPEG with P or B frames. Because of the way these 
  619.     frames are compressed, it would take a lot of computation (ie be slow) to 
  620.     jump exactly to the frame you want, so I jump to the nearest frame that 
  621.     can be calculated at reasonable speed. If you want to know more, read the 
  622.     technical note in this package.
  623. • Why when I try to random access a frame do I get sent to the same set of 
  624. frame numbers always?
  625.     Same reason as above.
  626.  
  627. • Why does my MPEG have the occasional block of garbage, mostly colored 
  628. green?
  629.     Some part of the MPEG file has become corrupt. This usually happens with 
  630.     MPEG files that have been uuencoded and have had a character or two lost 
  631.     or changed.
  632. • Why are large parts of my MPEG filled with green garbage, or with parts 
  633. of earlier scenes.
  634.     You have probably downloaded the MPEG file using gopher or ftp in ASCII 
  635.     format. The file is now useless. Download it again using BINARY mode. 
  636.     Better still, set your gopher or ftp application always to download .MPG 
  637.     suffix files in BINARY---don't trust its AUTOMATIC mode.
  638. • Why is the first frame of my MPEG all green?
  639.     Some people out there when they create an MPEG file, randomly start it 
  640.     where they feel like it. 
  641.     The consequence is that the first some bytes of the file are garbage and 
  642.     appear as an all green first frame. 
  643.     If you have one of these MPEGs, whenever you jump to the first frame, you 
  644.     won't see the first frame, but simply the last frame you were looking at. This 
  645.     is a consequence of the way Sparkle handles errors in the MPEG file format. 
  646.     Mostly it works well, but in this particular case it isn't great.
  647.     It is not too easy to work around this because of the many different ways
  648.     in which the MPEG can have garbage at the start before valid data begins.
  649.  
  650. • Why at the end of an MPEG is the last frame the same as the second to 
  651. last frame?
  652.     Some MPEGs just are created this way, with the last two frames as 
  653.     duplicates. This is a problem with those files, not a bug in Sparkle, and 
  654.     one just has to accept it. 
  655.     A similar type problem is that some video that's been converted to 30fps 
  656.     from 24fps film has duplicate frames every so often, and agin one just 
  657.     has to accept this for now.
  658.  
  659. • What does the Thread Manager do? Why do you make such a fuss over it?
  660.     The Thread Manager provides a way for a programmer to create a number of 
  661.     tasks within an application and have those tasks all run together. So 
  662.     with Sparkle every time the user asks for something that will takes some 
  663.     time, like playing an MPEG or saving a file in some different format, I 
  664.     create a task that does that work. If the Thread Manager isn't present, 
  665.     you, the user, can't create a number of these tasks and switch between 
  666.     them---you are restricted to doing only one thing at a time.
  667.  
  668. • When I started saving a file to MPEG, it got through two frames then sat there
  669. doing nothing for a long long time. Did it crash?
  670.     Especially when saving to MPEG, Sparkle creates a large number of blocks 
  671.     of memory. If the mac runs out of memory partway through performing 
  672.     this saving, it will run around trying everything it can to scrounge memory.
  673.     On my Quadra 610 I have seen it sit there for 45 seconds trying to free up 
  674.     memory before it concludes that there's nothing it can do and pops up an
  675.     error message. I guess on slower machines it might sit there for up to two
  676.     minutes. Just be patient and wait a while before concluding things
  677.     have crashed.
  678.  
  679. • Will you create a PowerPC native version? A version that uses the DSP in 
  680. the AV macs?
  681.     I don't have a PPC or an AV mac, and unless someone buys me one, I won't 
  682.     have either for sometime. Maybe when Symantec offer a Think C 7 that 
  683.     compiles to PowerPC, someone out there with a PowerPC will be able to 
  684.     do the compile for me. Until then, I'm afraid this is all that I can do.
  685.  
  686. • Where can I get MPEG files?
  687.     An ftp sites is 2k-ftp.CS.Berkeley.EDU in pub/multimedia. 
  688.     (This site used to be called toe.cs.berkeley.edu.)
  689.     
  690.     Here are some WWW sites
  691.     http://www.ccsf.caltech.edu/~johns/sl9.html  (CalTech)
  692.     http://newproducts.jpl.nasa.gov/sl9/images.html  (JPL)
  693.     http://seds.lpl.arizona.edu/sl9/sl9.html  (U. Arizona)
  694.     
  695. • Where can I find more about MPEG?
  696.     Read the UseNet MPEG FAQ. This is published in news.answers every so 
  697.     often, and can be ftp'd as         
  698.         host: ftp.cs.tu-berlin.de
  699.         file: /pub/msdos/windows3/graphics/mpegfaXX.zip
  700.     (XX is a version number).
  701.      Yeah, it's a zip file and that sucks, but that's life. There are a bunch 
  702.      of mac deZip'ers around so grab one and use it.
  703.      The latest version of this file as of July 94 to be 3.1.
  704.  
  705. • How can I deal with AVI files?
  706.     At mac.archive.umich.edu (and probably at sumex) 
  707.     in /mac/graphics/graphicsutil is vfw1.1utilities.sit.hqx
  708.     which handles AVI files and is supposed to work pretty well. 
  709.     
  710.  
  711. • Do I know of a program that ...?
  712.     Not really. 
  713.     I know of no Mac program that handles MPEG sound, or MPEGs with a .WAV 
  714.     file. There is source code floating around that converts MPEG sound to 
  715.     and from 16bit 44.2kHz samples, but it does not deal with MPEG 
  716.     video/audio synching and thus isn't yet of much use.
  717.     I know of no Mac program that can play windows AVI files.
  718.     My next major task is handling sound. 
  719.     But until I am done with that, I'm afraid you're out of luck.
  720.  
  721. ------------------------------------------------------------------------------
  722. WHY DOESN'T SPARKLE DO...
  723.  
  724. •    Why doesn't Sparkle read .gl, .dl and .fli files?
  725. One reason is that those file formats are awful. They give these dinky 
  726. low contrast horribly dithered images no-one would want to look at, and 
  727. they usually only have about 10 frames. Maybe, years from now, I'll add 
  728. those conversions, but they're about as low a priority as you get.
  729. At mac.archive.umich.edu (and probably at sumex)
  730. in /mac/graphics/graphicsutil is macanimviewer1.01.sit.hqx 
  731. which handles these various cheapo formats so you might want to grab it.
  732.  
  733. •    What about audio?
  734. MPEG has audio compression as well as video compression. I've been doing 
  735. lots of reading into this and pretty soon will start coding for it.
  736.  
  737. •    What about Video for Windows?
  738. I would be nice to support .AVI files. But right now I know nothing about 
  739. .AVI beyond the fact that it exists. Again any info anyone has is 
  740. appreciated. Until I know how .AVI works, how it fits into the windows 
  741. environment etc, I can't even tell you if it's practical for Sparkle to 
  742. try to support .AVI, let alone start the necessary coding.
  743.  
  744. •    Why don't you write an MPEG codec?
  745. Under QT 1.x there was no compelling need for this and no way to do it.
  746. QT 2.0 has some hooks for the use of MPEG. However when I tried beta's of 
  747. QT 2.0 on MPEG handling they consistently crashed. So for now I'm waiting 
  748. until the QT 2.0 MPEG framework is stable and actually works. When that 
  749. happens I'll consider things again.
  750.  
  751. •    Will I make the source available? 
  752. Yes, at some point. I had hoped to do so this release, but while the code 
  753. is 95% clean and readable, it's still not perfect, and don't yet think 
  754. it would help anyone much.
  755.  
  756. ------------------------------------------------------------------------------
  757. SMALL THINGS YOU MIGHT NOT HAVE NOTICED
  758.  
  759. The movie controller behaves pretty much like a standard QT controller. 
  760. You can step forward and backwards, hold down those buttons to play 
  761. forwards or backwards and click or drag in the central region to go to a 
  762. random point. 
  763. You can use the forward and backward arrow keys to step. 
  764. You can option click in the forward and backward steppers to go to the 
  765. beginning or end of the MPEG. Likewise using option forward or backward 
  766. arrow.
  767. You can start the movie playing using either return, spacebar, or 
  768. command forward arrow. You can stop playing using spacebar or return.
  769. You can yet play backwards by using command backward arrow. 
  770.  
  771. The visual clue that the movie is being saved is that 
  772. the movie controller loses its controls and shows only a relative position. 
  773. This is not a particularly obvious fact and may at some point be changed. 
  774. For now it works once you realize this fact.
  775.  
  776. When a movie is being saved, you can either stop the conversion 
  777. or pause it. To stop the conversion, use command-S (or the equivalent 
  778. menu option.) This will save the movie using the frames created so far.
  779. To pause the conversion use command-P, or the equivalent menu option, or 
  780. click in the movie controller. 
  781. The  saving will stop until you start that movie playing again. This is 
  782. occasionally useful if you want to pause a cinepak conversion to do a 
  783. short job on your mac.
  784. You can tell whether a movie is actively being saved or paused being 
  785. saved by looking at the indicator in the title bar. 
  786. If the first character in the title bar is 
  787.   S the movie is actively being saved,
  788.   P the movie is paused being saved,
  789.   R the movie is in realtime playback mode
  790.   A the movie is in play-all-frames playback mode.
  791.  
  792. If you are partway through a movie and save, the movie will be 
  793. rewound to the beginning for you. You do not need to be at the start of a 
  794. movie to save.
  795.  
  796. You can set the temporal quality options when saving to QuickTime 
  797. separately from the spatial quality options. If you need to do this, hold 
  798. down the option key while using the quality slider, and it will become a 
  799. temporal quality slider. 
  800.  
  801. ------------------------------------------------------------------------------
  802. THE FUTURE
  803.  
  804. The basic outline for now is
  805.     2.5 Cleaned up faster, smaller version of 2.0.
  806.     3.0 Handles sound.
  807.     3.5 Cleaned up faster, smaller version of 3.0.
  808. While adding these large additions I'll fix small things as I go, and as 
  809. I have time. I don't see the user interface improving much for some 
  810. time---more important things need my time.
  811.  
  812. I also want to add stuff to allow us to create movies. Morphs, special 
  813. effects, that sort of thing.
  814.  
  815. ------------------------------------------------------------------------------
  816. HOW CAN YOU HELP IMPROVE SPARKLE?
  817.  
  818. •    Any info on psycho-acoustic encoding?
  819. •    Any info on Microsoft Video for Windows?
  820. •    Any bug reports.
  821. •    Any ideas you have or suggestions. Your suggestions may go onto the 
  822.     list of things to do (currently two pages of single line items) but will 
  823.     probably be acted upon at some point. People have suggested several 
  824.     things to me I would not have thought of myself, so I do want your 
  825.     feedback.
  826. ------------------------------------------------------------------------------
  827. THANKS
  828.  
  829. * Many people all over the internet have helped me write this code.
  830. * Thanks to the people at Berkeley. Even though I've completely replaced 
  831.     their MPEG playback code with my own, they helped get this project started.
  832.     And, until I rewrite it, I'm using their MPEG encoding code.
  833. * Thanks to various usenet personalities who answered mac programming 
  834.     questions, mailed me quicktime header files and such. Special thanks to 
  835.     ldo in New Zealand, and Jon W{tte in Sweden, and bryanw, keeper of the 
  836.     MPEG FAQ, who mailed me about the Stanford MPEG encoder.
  837. * A special individual thank you goes to DS (he didn't want me to give his 
  838.     name but he knows who he is.) DS mailed me a CD ROM and ten floppies of 
  839.     information about QuickTime components after I complained that Apple was 
  840.     not making this information easily available. He's also provided me with 
  841.     information on QT 2.0 which will gradually be assimilated into Sparkle.
  842. * Thanks to Gene Chalfant who passed on a paper from NASA containing some 
  843.     interesting ideas on IDCT alternatives. 
  844. * Thanks to the mystery person in Britain who sent me some QT 2.0 
  845.     information in an envelope with no name attached to it.\
  846. * Thanks to Jamie McCarthy for code for touching Finder folders.
  847. * Thanks to Troy Gaul for the Infinity Windoid.
  848. * Thanks to Richard Lim for the current set of icons used by Sparkle.
  849.     (Which I modified a little so it's probably best to blame me rather than 
  850.     him for poor design choices if you don't like them.)
  851. * Thanks to Stuart Cheshire for mailing me a QT 2.0beta CD-ROM and misc 
  852.     useful info.
  853. * Thanks to everyone who's mailed in bug reports or suggestions. Even when 
  854.     I can't implement suggestions at once, they go on the list for inclusion 
  855.     in a few months. 
  856. * Thanks to Apple for making the greatest computers in the world. 
  857.     (Though sadly they seem to be going completely clueless with regard to 
  858.     how to distribute their various new ideas. I fear if they don't get their 
  859.     act together about this soon, NO-ONE will support these new things 
  860.     because developers will have no idea whose machine has what on it.)
  861. * Thanks also to Symantec for creating such a great programming environment.
  862.     This program was written with Think C 5, then Think C 6  and now Think C 7 
  863.     using the Think Class Library. Having coded on Windows, X-windows, and 
  864.     the Mac, I can unreservedly say that the Mac is by far the most pleasant 
  865.     platform for a programmer.
  866.  
  867. (If I've forgotten your name here by mistake and you really deserve to be 
  868. here, please remind me.)
  869.  
  870. Maynard Handley 
  871. maynard@elwing.otago.ac.nz
  872. September 04 1994